<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
		<style>
			img.mui-media-object {
				width: 100% !important;
				height: 300px !important;
				/* max-height: 65px !important;
				max-width: 65px !important;
				border-radius: 50%; */
				display: block;
				border: 1px solid #ddd;
			}
			#btnPaiShe{
				width: 100%;
			}
		</style>
	</head>
	<body>
		<nav class="mui-bar mui-bar-tab">
			<a class="mui-tab-item mui-active" href="#tabbar">
				<span class="mui-icon mui-icon-home"></span>
				<span class="mui-tab-label">首页</span>
			</a>
			<a class="mui-tab-item" href="#tabbar_message">
				<span class="mui-icon mui-icon-email"></span>
				<span class="mui-tab-label">消息</span>
			</a>
			<a class="mui-tab-item" href="#tabbar_contact">
				<span class="mui-icon mui-icon-contact"></span>
				<span class="mui-tab-label">通讯录</span>
			</a>
			<a class="mui-tab-item" href="#tabbar_setting">
				<span class="mui-icon mui-icon-gear"></span>
				<span class="mui-tab-label">设置</span>
			</a>
		</nav>
		<div class="mui-content">
			<div id="tabbar" class="mui-control-content mui-active">
				<div class="title">首页</div>
			</div>
			<div id="tabbar_message" class="mui-control-content">
				<div class="title">消息</div>
			</div>
			<div id="tabbar_contact" class="mui-control-content">
				<div class="title">通讯录</div>
			</div>
			<div id="tabbar_setting" class="mui-control-content">
				<img id="tx" class="mui-media-object" src="http://img.cdn.aliyun.dcloud.net.cn/ask/img/%E5%B9%BF%E5%91%8A%E4%BD%8D%E6%8B%9B%E7%A7%9F.jpg">
				<button id="btnPaiShe" type="button" class="mui-btn mui-btn-primary">点击拍照切换头像</button>
			</div>
		</div>

		<script src="js/mui.min.js"></script>
		<script src="js/mui.enterfocus.js"></script>
		<script src="js/app.js"></script>
		<script>
			(function($, doc) {
				$.init({
					statusBarBackground: '#f7f7f7'
				});
				$.plusReady(function() {
					//检查 "登录状态/锁屏状态" 结束
					// 					var ps = doc.getElementById('btnPaiShe');
					// 					ps.addEventListener('tap', function(event) {
					// 						var cmr = plus.camera.getCamera();
					// 						cmr.captureImage(function(path) {
					// 							plus.io.resolveLocalFileSystemURL(path, function(enty) {
					// 
					// 								doc.getElementById('tx').src = enty.toLocalURL();
					// 							});
					// 						}, function(e) {});
					// 
					// 					});


					var ps = doc.getElementById('btnPaiShe');
					ps.addEventListener('tap', function(event) {
						var cmr = plus.camera.getCamera();
						cmr.captureImage(function(path) {
								plus.io.resolveLocalFileSystemURL(path, function(enty) {
									doc.getElementById('tx').src = enty.toLocalURL();
								});
								alert("Capture image success: " + path);
							},
							function(error) {
								alert("Capture image failed: " + error.message);
							}, {

							}
						);

					});




				});

			}(mui, document));
		</script>

	</body>
</html>
